
package com.sd.jdbc;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;

public class Deleteprepared {
	public static void main(String[] args) throws Exception{
		//registering the driver
			//Class.forName("oracle.jdbc.oracle.OracleDriver");
			DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
			System.out.println("driver registered");
			//Established connection
			Connection conn=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE","system","tiger");
			System.out.println("connection Established");
			//create prepared statement
			PreparedStatement ps=conn.prepareStatement("delete from Emp1 where id=?");
			System.out.println("statement prepared");
			//delete with value
	ps.setInt(1,1005);
		//ps.setString(2,"satru");
	int i=ps.executeUpdate();
	System.out.println(i + "records deleted");

			conn.close();
		}
		
		

	}




